package com.ruoyi.hr.controller.hr.salaryquery.interfacesalaryhistory;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.hr.domain.Authority;
import com.ruoyi.hr.service.AuthorityService;
import com.ruoyi.hr.service.salaryquery.InterfaceSalaryHsitoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @author zeo
 * @explain 薪资接口历史
 * @date 2020/3/17
 */
@Controller
@RequestMapping("/salaryQuery/InterfaceSalaryHistory")
public class InterfaceSalaryHistoryController extends BaseController {

    @Autowired
    InterfaceSalaryHsitoryService interfaceSalaryHsitoryService;

    @Autowired
    AuthorityService authorityService;

    private String prefix = "hr/salaryquery/interfacesalaryhistory";

    @GetMapping("/addSalaryHistory")
    public String addSalaryHistory() {
        return prefix + "/addSalaryHistory";
    }

    @RequestMapping("/findAddPro")
    @ResponseBody
    public List<String> findAddPro(String jsid) {
        return interfaceSalaryHsitoryService.findAddPro(jsid);
    }

    @RequestMapping("/addList")
    @ResponseBody
    public TableDataInfo addList(@RequestParam Map map) {
        Authority authority = authorityService.findAuthorAndIsAdmin();
        map.put("authority", authority);
        return getDataTable(interfaceSalaryHsitoryService.addList(map));
    }

    @GetMapping("/attSalaryHistory")
    public String attSalaryHistory() {
        return prefix + "/attSalaryHistory";
    }

    @RequestMapping("/findAttPro")
    @ResponseBody
    public List<String> findAttPro() {
        return interfaceSalaryHsitoryService.findAttPro();
    }

    @RequestMapping("/attList")
    @ResponseBody
    public TableDataInfo attList(@RequestParam Map map) {
        Authority authority = authorityService.findAuthorAndIsAdmin();
        map.put("authority", authority);
        return getDataTable(interfaceSalaryHsitoryService.attList(map));
    }
}
